#ifndef FOODTYPECONTROLLER_H
#define FOODTYPECONTROLLER_H

#include <QNetworkAccessManager>
#include <QWidget>
#include <iostream>
#include "json/json.h"
#include <fstream>
#include <QObject>
#include <QString>
#include <QtNetwork>
#include <QJsonObject>
#include <QJsonDocument>

struct foodTypeInfo{
    int version;
    QString gmtCreate;
    QString gmtModified;
    int valid;
    int isDeleted;
    int id;
    QString name;
    QString pic;
};
struct messageInfo{
    int code;
    QString data;
    QString message;
};

class FoodTypeController : public QObject
{
    Q_OBJECT
public:
    explicit FoodTypeController(QObject *parent = nullptr);
    QNetworkAccessManager *accessManager;
    QNetworkRequest request;
    QByteArray postData;
    QNetworkReply* reply;
    QList<foodTypeInfo> foodTypeList;
    messageInfo m_messageinfo;
    void getFoodTypeList();

private slots:
    void finishedSlot(QNetworkReply *reply);
signals:
    void getFoodTypeListSuccess();
};

#endif // FOODTYPECONTROLLER_H
